<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <script src="https://cdn.socket.io/socket.io-3.0.1.min.js"></script>
    </head>
    <body>
        <input type="text" id="input" />
        <input type="button" onclick="send()" value="发送" />
        <script>
            const socket = io.connect("ws://localhost:3112");
            socket.on("connect", function (socket2) {
                console.log("Connection with Server established!");
                socket.emit("messages", "Client has established connection with Server");
            });
            const send = () => {
                socket.emit(document.getElementById("input").value);
            };
        </script>
    </body>
</html>
